<template>
	<view class="container">
		<!-- 顶部 -->
		<view class="head"
			:class="{'home-head-bg1':currentBackground === 'bg1', 'home-head-bg2':currentBackground === 'bg2'}">
			<view class="left-title">
				<image @click="goBack" class="icon" src="@/static/style1/onleft.png" mode="aspectFit"></image>
			</view>
			<text class="title">{{title}}</text>
			<text class="right-title">{{rights}}</text>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		props: {
			title: {
				type: String,
				required: true
			},
			rights: {
				type: String,
			}
		},
		data() {
			return {

			}
		},
		methods: {
			// 返回上一级
			goBack() {
				uni.navigateBack()
			}
		},
		computed: {
			...mapState('theme', ['currentBackground'])
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		position: relative;
		width: 100%;

		padding-top: 12rpx;
		position: relative;

		.head {
			height: 80rpx;
			width: 100%;

			// background-size: 100% 63rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 20rpx;

			.title {
				position: absolute;
				left: 50%;
				transform: translateX(-50%);
				top: 20rpx;
			}

			.left-title {

				width: 48rpx;
				height: 48rpx;
				position: relative;
				left: 48rpx;
				top: 20rpx;

				.icon {

					height: 48rpx;
					width: 48rpx;

				}
			}

			.right-title {
				padding-right: 30rpx;
				padding-top: 10rpx;
				font-size: 12px
			}
		}
	}
</style>